package com.wenx.camel;

import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;

public class App7 extends RouteBuilder {

    public static void main(String[] args) throws Exception {

        CamelContext context = new DefaultCamelContext();
        //new ClassPathXmlApplicationContext("jetty/camel.xml");
        context.addRoutes(new App7());
        context.start();
        boolean loop = true;
        while (loop) {
            Thread.sleep(25000);
        }
        context.stop();
    }

    public void configure() throws Exception {
                from("jetty://http://www.google.com")
                        .streamCaching()
                .process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        System.out.println(exchange.getOut().getBody());
                    }
                })
                .to("log:output");
    }
}
